#pragma once

class SimpleStringCoder
{
public:
	static char const* Encode(char const* msg,char* buff,int buffLen)
	{
		char const* maxBuffPos = buff + (buffLen - 2);
		char const* pMsg = msg;
		char* pBuff = buff;
		for (;*pMsg != 0 && pBuff < maxBuffPos;	++pMsg,pBuff += 2)
		{
			Char2Other(*pMsg,pBuff);
		}
		*pBuff = 0;
		return buff;
	}
private:
	static void Char2Other(unsigned char c,char* out)
	{
		static char s_dic[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
		out[0] = s_dic[c / 31];
		out[1] = s_dic[c % 31];
	}

};